package com.demo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo.domain.Blog;
import com.demo.mapper.BlogMapper;
import com.mapperdb.db.Db;

@Service
public class BlogServiceImpl implements BlogService {

	@Autowired
	BlogMapper blogMapper0;

	@Override
	public void save2() {
		Blog blog = blogMapper0.selectByPrimaryKey(13);
		blog.setContent("666");
		blogMapper0.updateByPrimaryKey(blog);
		blog = blogMapper0.selectByPrimaryKeys(blog);
		System.out.println(blog);
	}

	@Override
	public void save() {
		Blog blog = Db.selectByPrimaryKey(Blog.class, 13);
		blog.setContent("555");
		Db.updateByPrimaryKey(Blog.class, blog);
		blog = Db.selectByPrimaryKey(Blog.class, 13);
		System.out.println(blog);
	}
}
